package com.yawn.groovydemo

class Test {

    def static p = new Person(18, 'yawn', new Date())

    static void main(String[] args) {
        printPerson(p)
        printPerson.call(p)
    }



    def static printPerson = {
        person ->
            println "person: ${person}"
    }
}

class Person {

    int age
    String name
    Date birthday

    Person(int age, String name, Date birthday) {
        this.age = age
        this.name = name
        this.birthday = birthday
    }


    @Override
    String toString() {
         "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", birthday=" + birthday +
                '}'
    }
}
